<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>

</head>

<body>
    <button>axios提交</button>

    <script>
        const oBtn = document.querySelector("button")

        oBtn.onclick = async function () {
            try {
                const re = await axios({
                    url: "/user",
                    method: "get",
                    //响应头
                    header: {},
                    // 即将与url一起提交上去的请求 
                    params: {
                        userId: "001",
                        t: Date.now()
                    },
                    //后端数据
                    data: {},
                    timeout: 10000,
                })
                console.log("re", re.data);
            } catch (e) {
                console.log(e.message);
            }
        }
    </script>
</body>

</html>